package com.teatrace.service.impl;

import java.util.List;

import javax.jws.WebService;

import com.dao.genericdao.IBaseDao;
import com.teatrace.model.Product;
import com.teatrace.service.TraceService;

@WebService(endpointInterface="com.teatrace.service.TraceService")
public class TraceServiceImpl implements TraceService {
	
	private IBaseDao<Product, Integer> productDao;

	@Override
	public Product getWithTraceInfo(String productNum) {
		List<Product> list = productDao.findByNamedParams("from Product where productNum=:productNum", new String[] {"productNum"}, productNum);
		if(null == list || list.size() < 1) {
			return null;
		}
		return list.get(0);
	}

	public IBaseDao<Product, Integer> getProductDao() {
		return productDao;
	}

	public void setProductDao(IBaseDao<Product, Integer> productDao) {
		this.productDao = productDao;
		this.productDao.setEntityClass(Product.class);
	}
	
	

}
